
#pragma once

#include "Input.h"

class CDirectInput
{
public:
	friend class CDirectInputDevice;
	enum DIDeviceType
	{
		DI_Mouse = 0,//DI8DEVTYPE_MOUSE            0x12
		DI_Keyboard,//DI8DEVTYPE_KEYBOARD         0x13
		DI_Joystick,//DI8DEVTYPE_JOYSTICK         0x14
		DI_Gamepad,//DI8DEVTYPE_GAMEPAD          0x15
		DI_Driving,//DI8DEVTYPE_DRIVING          0x16
		DI_Flight,//DI8DEVTYPE_FLIGHT           0x17
		DI_1STPerson,//DI8DEVTYPE_1STPERSON        0x18
		DI_DeviceCtrl,//DI8DEVTYPE_DEVICECTRL       0x19
		DI_ScreenPointer,//DI8DEVTYPE_SCREENPOINTER    0x1A
		DI_Remote,//DI8DEVTYPE_REMOTE           0x1B
		DI_Supplemental,//DI8DEVTYPE_SUPPLEMENTAL     0x1C
		DI_MaxDeviceType
	};

	typedef std::vector<DIDEVICEINSTANCE>  DIInstArray_t;

	friend BOOL CALLBACK DIEnumDevicesCallBack( LPCDIDEVICEINSTANCE lpDdi,LPVOID pvRef);
	CDirectInput();
	~CDirectInput();

	int GetDeviceInstanceCount( DIDeviceType type );
	LPCDIDEVICEINSTANCE GetDeviceInstance( DIDeviceType type,int iDevice);

	int GetMouseInstanceCount();
	LPCDIDEVICEINSTANCE GetMouseInstance( int iMouse);

	int GetKeyboardInstanceCount();
	LPCDIDEVICEINSTANCE GetKeyboardInstance( int iKeyboard );

	int GetJoystickInstanceCount();
	LPCDIDEVICEINSTANCE GetJoystickInstance( int iJoystick );

	LPDIRECTINPUTDEVICE8 CreateDevice( LPCDIDEVICEINSTANCE pDevInst );

	
	virtual bool Create( HWND hWnd );
	virtual void Destroy();

protected:
	HWND m_hWnd;
	CComPtr<IDirectInput8> m_pDI;
	std::vector<DIInstArray_t> devInst;
};



